﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace CMSLibrary.TagsCreate.CustomFunction.Common
{
    /// <summary>
    /// 一年中的第几天
    /// 1.  DayOfYear()
    /// 2.  DayOfYear(2007-12-12)  指定日期
    /// </summary>
    public class Custom_DayOfYear : PFunctionBase
    {
        #region 参数成员
        /// <summary>
        /// 源日期
        /// </summary>        
        DateTime source = DateTime.Now;        
        #endregion

        #region 重写的方法
        protected override void SplitFormatParas(string sourceParas)
        {
            string[] paras = GetParasArray(sourceParas);
            //确定重载方法,由多到少             
            /********** 2 **********/
            try
            {
                source = Convert.ToDateTime(paras[0]);
                FunctionBurden = BurdenIndex.two;
                return;
            }
            catch { }
            /********** 1 **********/
            try
            {
                FunctionBurden = BurdenIndex.one;
                return;
            }
            catch { }
        }

        public override string ToString()
        {
            return source.DayOfYear.ToString();
        }
        #endregion
    }
}